import axios from '@/libs/axios1';
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' };
let baseUrl = '/scientific/gitManage';
// 添加用户代码
export const addGitProject = (data) => {
    return axios({
        url: `${baseUrl}/project`,
        method: 'POST',
        params: data,
        headers: jsonHeaders,
    });
};

// 修改用户代码
// export const updateGitProject = (id, data) => {
//     return axios({
//         url: `${baseUrl}/${id}`,
//         method: 'PUT',
//         data,
//         headers: jsonHeaders,
//     });
// };

//删除用户代码
export const delGitProject = (id) => {
    return axios({
        url: `${baseUrl}/project?projectId=${id}`,
        method: 'DELETE',
        headers: jsonHeaders,
    });
};

//查询用户代码
export const queryGitProject = (params) => {
    return axios({
        url: `${baseUrl}/projects`,
        method: 'GET',
        params,
        headers: jsonHeaders,
    });
};

// 添加用户代码分支
export const addGitProjectBranch = (projectId, data) => {
    return axios({
        url: `${baseUrl}/branch?projectId=${projectId}`,
        method: 'POST',
        data: data,
        headers: jsonHeaders,
    });
};

//删除用户代码分支
export const delGitProjectBranch = (id, branchName) => {
    return axios({
        url: `${baseUrl}/branch?projectId=${id}&branchName=${branchName}`,
        method: 'DELETE',
        headers: jsonHeaders,
    });
};

//查询用户代码分支
export const queryGitProjectBranch = (params) => {
    return axios({
        url: `${baseUrl}/branches`,
        method: 'GET',
        params,
        headers: jsonHeaders,
    });
};

//查询用户代码标签信息
export const queryGitProjectTag = (params) => {
    return axios({
        url: `${baseUrl}/project/tags`,
        method: 'GET',
        params,
        headers: jsonHeaders,
    });
};

//查询用户代码修改记录
export const queryGitProjectCommit = (params) => {
    return axios({
        url: `${baseUrl}/project/commits`,
        method: 'GET',
        params,
        headers: jsonHeaders,
    });
};

//查询当前git账号密码
export const getGitInfo = () => {
    return axios({
        url: `${baseUrl}/getGit`,
        method: 'GET',
        headers: jsonHeaders,
    });
};
